package com.fr.data.core.db.handler;

import com.fr.data.core.db.dialect.Dialect;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class BigDecimalTypeHandler extends AbstractSQLTypeHandler
{
  public void setValue(PreparedStatement paramPreparedStatement, int paramInt1, Object paramObject, int paramInt2, Dialect paramDialect)
    throws SQLException
  {
    if (paramObject instanceof BigDecimal)
      paramPreparedStatement.setBigDecimal(paramInt1, (BigDecimal)paramObject);
    else
      checkIsString(paramPreparedStatement, paramInt1, paramObject, paramInt2);
  }

  protected void parseString(PreparedStatement paramPreparedStatement, int paramInt, String paramString)
    throws Exception
  {
    paramPreparedStatement.setBigDecimal(paramInt, new BigDecimal(paramString));
  }

  public Object getValue(ResultSet paramResultSet, int paramInt1, int paramInt2, Dialect paramDialect)
    throws SQLException
  {
    return paramResultSet.getBigDecimal(paramInt1);
  }
}